<?php  


class HuodongguanliTable extends We7Table {

    protected $tableName;

    private $page;
    
    public function __construct(){
        
        parent::__construct();
        $this->tableName = 'szxh_activeexpirty_actionchange';
        $this->page = '';
    }
    public function getdate($page = 1) {
        $size = 10;
        $list = $this->query
                     ->from($this->tableName)
                     ->orderby('id','DESC')
                     ->page($page, $size)
                     ->getall();
        $total = $this->query->getLastQueryTotal();
        $this->page = pagination($total,$page,$size);
        return $list;
    }

    public function pagesort() {
        return $this->page;
    }

    public function getrow($uid) {
        return $this->query->from($this->tableName)->where('id', $uid)->get();
    }
    public function upDate($chdate,$uid) {
        $uparr = array('title' => $chdate['title'],
                    'image' => $chdate['image'],
                    'des' => $chdate['ueditor'],
                    'time' => $chdate['date'],
                    'ltitle' => $chdate['titname'],
                    'music' => $chdate['audio'],
                    'price' => $chdate['price'],
                    'incooker' => $chdate['lncooker'],
                    'imag' => $chdate['imag'],
                    'sort' => $chdate['selectname'],
                    'state' => $chdate['state']
                );
        $chdateone = pdo_update('szxh_activeexpirty_actionchange',$uparr,array('id'=>$uid));
        if($chdateone) {
            message('保存成功', aurl(), 'success');
        } else {
            message('保存失败', 'referer', 'error');
        }
        return $chdateone;
    }
    public function insertDate($addate) {
        $arr = array('title' => $addate['title'],
                    'image' => $addate['image'],
                    'des' => $addate['ueditor'],
                    'time' => $addate['date'],
                    'ltitle' => $addate['titname'],
                    'music' => $addate['audio'],
                    'price' => $addate['price'],
                    'incooker' => $addate['lncooker'],
                    'imag' => $addate['imag'],
                    'sort' => $addate['selectname']
                );
        $res = pdo_insert('szxh_activeexpirty_actionchange',$arr);


        $sumdate = pdo_getall('szxh_activeexpirty_actionchange');
    }
    public function delDate($date) {
        foreach ($date as $value) {
            $delat = pdo_delete('szxh_activeexpirty_actionchange',array('id' => $value));
            
        }
        return;
    }

}

?>